package com.subaiqiao.yunshiyuan.entrance.ysy.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.subaiqiao.yunshiyuan.basis.mapper.BasisMapper;
import com.subaiqiao.yunshiyuan.entrance.ysy.pojo.FileValue;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.subaiqiao.yunshiyuan.entrance.ysy.vo.FileValueVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 曹朝禹
 * @since 2022-05-13
 */
@Mapper
public interface FileValueMapper extends BasisMapper<FileValue> {

    @Select("SELECT file_value.*, a.username username " +
            "FROM file_value " +
            "LEFT JOIN user_info a ON file_value.user_id=a.user_id ${ew.customSqlSegment}")
    List<FileValueVO> FillFileValueVOPage(Page<FileValueVO> page, @Param(Constants.WRAPPER) QueryWrapper<FileValueVO> wrapper);

    @Select("SELECT COUNT(*) FROM file_value")
    Integer FindFileValueCount();

    @Select("SELECT COUNT(*) FROM file_value WHERE TO_DAYS(NOW()) - TO_DAYS(create_datetime)=1")
    Integer FindFileValueYesterdayRegister();

}
